#include <stdio.h>

int main()
{
    int N;
    while (scanf("%d", &N) && N > 0)
    {
        int i, last = 0;
        for (i = 0; i < N; i++)
        {
            int num;
            scanf("%d", &num);
            if (num != last)
            {
                printf("%d ", num);
                last = num;
            }
        }
        printf("$\n");
    }
}